package com.college.dao;

import com.college.entity.User;

public class UserDao extends BaseDao<User>{
	public User  queryToLogin(String account,String pwd) {
		String hql="from User where phone=? and pwd=?";
		User user=queryEntiy(hql, account,pwd);
		return user;
	}
	public void save(User user) {
		super.save(user);
	}
	public Boolean  checkRegeister(String account) {
		String hql="from User where phone=?";
		User user=queryEntiy(hql, account);
		if (user!=null) {
			return false;
		}
		return true;
	}
	
	public void updateToPassword(User user) {
		String hql="update User set pwd='"+user.getPwd()+"' where phone = '"+user.getPhone()+"' and pwd = '"+user.getOldpass()+"'";
		super.update(hql);
	}
}
